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

Query time 0.00027