UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'atKBXjV+1zwQ+IsaQiRo5KdLtB2TsGMwfNS94cSfyPE=' 
WHERE 
  key_id = '06f12290cbb729fb1e594f5df225918101140d1e79b0e7c25aa249abd46fb061' 
  AND (
    token = 'atKBXjV+1zwQ+IsaQiRo5KdLtB2TsGMwfNS94cSfyPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057