UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rBOaD1EhxRNX2MXD8IDZZzZjAfpuQqed8IU9oJmksNQ=' 
WHERE 
  key_id = '17a2e32fc9628062d572dc2ff42d45ba2ed1b10d9b44b1a7349997e7e5938862' 
  AND (
    token = 'rBOaD1EhxRNX2MXD8IDZZzZjAfpuQqed8IU9oJmksNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032