UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J53xr8stKAvqo9uHvZdqTTfjRtTupuJtdQ15UOpFVKA=' 
WHERE 
  key_id = '4cb09ae82afce2343f384103bee09860c993691f9154690d34160b55beb2142c' 
  AND (
    token = 'J53xr8stKAvqo9uHvZdqTTfjRtTupuJtdQ15UOpFVKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049