UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hp9tG1agYg6mH1T/aTM0SCcrJZajIPjbwcWGVHHMBbM=' 
WHERE 
  key_id = 'b3de6a0f5a56f7de20db549ec078aaeed66273ad68357d28149d0e14729ce895' 
  AND (
    token = 'hp9tG1agYg6mH1T/aTM0SCcrJZajIPjbwcWGVHHMBbM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00090