UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/BTDYMxPcKn/o5e79h3LKGTTGS+eO5IUFi6DQI8v2E=' 
WHERE 
  key_id = 'd4298f86c12637fca550b7774650a9039d4e1b814fe607ce16ee5fa27d27496d' 
  AND (
    token = 'I/BTDYMxPcKn/o5e79h3LKGTTGS+eO5IUFi6DQI8v2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042