UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pO3Xwe0iaPjb8fL4qcLo5dwhBzSQQMC/ovktwZUc1pY=' 
WHERE 
  key_id = '58991481ec993db8b090605e6314b16f88963cd095323a07db239bbe34b1c0b5' 
  AND (
    token = 'pO3Xwe0iaPjb8fL4qcLo5dwhBzSQQMC/ovktwZUc1pY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029