UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R6aa9sRlrZgtqq+Vj5gN93MaG3dUO/taRU5ogM/NXnc=' 
WHERE 
  key_id = 'd43b69fda9cd990a124fdc844893ba5f715432b7f4fedc0c4e3c647756f1ce32' 
  AND (
    token = 'R6aa9sRlrZgtqq+Vj5gN93MaG3dUO/taRU5ogM/NXnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025