UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'McIMn0AVFCjDy9uHwHy35JEJ7wjaoQyZKqXeRrIs5uk=' 
WHERE 
  key_id = '54e6917291527b95346e4915c158238d8d5e3ea9456a107ef121bfa834185ce0' 
  AND (
    token = 'McIMn0AVFCjDy9uHwHy35JEJ7wjaoQyZKqXeRrIs5uk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054