UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dUabOsVSY1xT1ss9D/zTmnKGB7JD1y0w0GH9TCS/FHw=' 
WHERE 
  key_id = '476e46a18a1ca3d410e75aaee4e85bf7d238dc2b99472e61292841580793943a' 
  AND (
    token = 'dUabOsVSY1xT1ss9D/zTmnKGB7JD1y0w0GH9TCS/FHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024