UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rAquQ78HP8BRKp+/tsCu2AowpHudyr2grUNgQQQL/L4=' 
WHERE 
  key_id = '0d903440d8d4811f13e7cd122261a15f557e8caf813086137a542001bb481858' 
  AND (
    token = 'rAquQ78HP8BRKp+/tsCu2AowpHudyr2grUNgQQQL/L4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031