UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1dFb/Xd8SfB30Z0ECESu6KZpP9kiCFYS9JW+OyJ/X/8=' 
WHERE 
  key_id = '51a5aa12706c473684a07a21e05beb976966c89a5805492addf5d81364b364a6' 
  AND (
    token = '1dFb/Xd8SfB30Z0ECESu6KZpP9kiCFYS9JW+OyJ/X/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019