UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0/plVWJ3jnuYsc7QqI5eawDm1r1oKC4KSLjhKjivX64=' 
WHERE 
  key_id = 'ac6edfff9b49e3493c46f8dfa523309e5d17e5df82a156367c0e4525f4f45674' 
  AND (
    token = '0/plVWJ3jnuYsc7QqI5eawDm1r1oKC4KSLjhKjivX64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032