UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CYhP0ekuaRANH5X7hQGUXNSimJUQekZiasoBryVoEXg=' 
WHERE 
  key_id = '4f5a75a73eb1a6029f0c72075b634d99b7177d8668fcb3266e59e45e0b1f8571' 
  AND (
    token = 'CYhP0ekuaRANH5X7hQGUXNSimJUQekZiasoBryVoEXg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028