UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'moHXKJbAcMmA0uvD4eZo6H8hiTOphmGtbCdu2Cwa+Vs=' 
WHERE 
  key_id = 'bd998e79b43554639536eb527ce752d0ba72f2cb6ecdc63d0faf164e51bef8d5' 
  AND (
    token = 'moHXKJbAcMmA0uvD4eZo6H8hiTOphmGtbCdu2Cwa+Vs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038