UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GQbbMtWP1GvaWzCRFlQpt+ID7Ki3Ws2NHLcrK8WkxV8=' 
WHERE 
  key_id = '9c51996875ef0980a16983786a7e2a53cf4937215b26cdaa398e23ac0d90477e' 
  AND (
    token = 'GQbbMtWP1GvaWzCRFlQpt+ID7Ki3Ws2NHLcrK8WkxV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048