UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aA80ellv+W6WJSwNan/0RepC5fWij2Qe4erjoKr8OME=' 
WHERE 
  key_id = '2fe076df27411bf87376b71fb957ed49800618b7947f685ab96265ff48ac65fe' 
  AND (
    token = 'aA80ellv+W6WJSwNan/0RepC5fWij2Qe4erjoKr8OME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024