UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XFxPEy5JSu1x9hhyHthBRdQxf5g2Da4udbZVzdWT2Mg=' 
WHERE 
  key_id = 'd63dce3945ebc839e30f5de22d6dcbea77c1daac9ee3952d7126bfbf63772780' 
  AND (
    token = 'XFxPEy5JSu1x9hhyHthBRdQxf5g2Da4udbZVzdWT2Mg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038