UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sds1DXbnkIYMF6zKX2/Nqy/ahRSp/N8gwv9qrDv77v0=' 
WHERE 
  key_id = '974883fcd28560829288f0d89a8a544c85259934e19daf084f7c1991c53e00fa' 
  AND (
    token = 'sds1DXbnkIYMF6zKX2/Nqy/ahRSp/N8gwv9qrDv77v0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049