UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SVxhaeafNQW51335q98Sz6LrHrOkHubERMwTY+uHsJw=' 
WHERE 
  key_id = 'a2d2740f80e14cf900296c7fa8278a897c6c186e654682ef220b47875b96f0e9' 
  AND (
    token = 'SVxhaeafNQW51335q98Sz6LrHrOkHubERMwTY+uHsJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038