UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qo2DUi8HfPSXaOU4epCJNCGg9RCVFjW4yN7wDiw6lSY=' 
WHERE 
  key_id = '9093a916b3b5f21003259d1c32a312a0993d5bfa507ab25bd7010eb4dcb5225f' 
  AND (
    token = 'Qo2DUi8HfPSXaOU4epCJNCGg9RCVFjW4yN7wDiw6lSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028