UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4G8TA4N0TDeTcWcKK623iMY3gYR4+1XM38ky6h701zc=' 
WHERE 
  key_id = 'f63e76e16e0f6722b4b8384be978bd939c23bf478271a0f42ab157c9411f8810' 
  AND (
    token = '4G8TA4N0TDeTcWcKK623iMY3gYR4+1XM38ky6h701zc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038