UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FW2GRgY70pLuCPH4GEZUwercz3RRkYnFAP9gqLquXGw=' 
WHERE 
  key_id = '22e952c418884ee0b84439304b91b90060d04b16cf698c05ecf81e2b38bccf30' 
  AND (
    token = 'FW2GRgY70pLuCPH4GEZUwercz3RRkYnFAP9gqLquXGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041