UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rH3swnv11/OqvC5OedjNiSumnRYPIJ4S61TFTCDDb+k=' 
WHERE 
  key_id = '5283463d08eee86d347c44a5e905a9093c8a2c014709e89b0259d2b106b5022d' 
  AND (
    token = 'rH3swnv11/OqvC5OedjNiSumnRYPIJ4S61TFTCDDb+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029