UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5AJHHViUNwzWsi4vvGOOVff2CEsw6RQxpzU73bSO+y4=' 
WHERE 
  key_id = 'f8376dc711a1a1810a1d863d6aecfa223784db97f4e9f70a6945459840ca0c6c' 
  AND (
    token = '5AJHHViUNwzWsi4vvGOOVff2CEsw6RQxpzU73bSO+y4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042