UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rsCAju0Lou/u447b3HJl4dnAFvpCd/QUPe91VoVX/wA=' 
WHERE 
  key_id = '8ef1bd07503ebc5f20a182b97a0502d7fe192edd1fa779e06ec00cc2b6a34013' 
  AND (
    token = 'rsCAju0Lou/u447b3HJl4dnAFvpCd/QUPe91VoVX/wA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022