UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BqeXQTEj1xlSlyrF0YwtFNUUadnqWzLpo9TsMXpt4GU=' 
WHERE 
  key_id = 'f20a5dc99fbf0d8df4381aa061a0230764045d34406349ac0fa8a5588c899dd6' 
  AND (
    token = 'BqeXQTEj1xlSlyrF0YwtFNUUadnqWzLpo9TsMXpt4GU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038