UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IJJT5sReDbSReO5/nZMEx/NFol6YmteSrNkc052Wipc=' 
WHERE 
  key_id = 'b157033fdcc71cae44065d18ac097f847547e8622114d2232776c515218720aa' 
  AND (
    token = 'IJJT5sReDbSReO5/nZMEx/NFol6YmteSrNkc052Wipc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031