UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K9kDp0E3ynqG2jKB5kIHzG+x+oI+t1qSIOOVj8u7mc0=' 
WHERE 
  key_id = '7912b131a75eb0aac7b32d654605a53145bbd29eacdf5a68d8f5279a010b4e33' 
  AND (
    token = 'K9kDp0E3ynqG2jKB5kIHzG+x+oI+t1qSIOOVj8u7mc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073