UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7SbEZhlme563ffzN3t1l0XJen9KdX6I8AdMygZ3KiAY=' 
WHERE 
  key_id = '69a84c73310038d7c0711d02e36e055c01c55937ef86a8b84f5a67d11a6498c3' 
  AND (
    token = '7SbEZhlme563ffzN3t1l0XJen9KdX6I8AdMygZ3KiAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039