UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CN0UGQN1ip+lPTpC71CAFO732nCH2EsRTnTLIteLesQ=' 
WHERE 
  key_id = '27a55773f1e75354a54290166148e22613e8f0002b633ebbedd4727915e9daff' 
  AND (
    token = 'CN0UGQN1ip+lPTpC71CAFO732nCH2EsRTnTLIteLesQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020