UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YvriYxWf30r8xWDlFhA1m+PPoeLVAuGea/3hQ4ziPoc=' 
WHERE 
  key_id = '9cc402ed9731656464e9c46992900e9c00b40dad96d47449c1f0adabae4ce4f8' 
  AND (
    token = 'YvriYxWf30r8xWDlFhA1m+PPoeLVAuGea/3hQ4ziPoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028