UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dckYC6HgYZbJ8NbScEkevwfp9FpnUVYOnp546ysPLmA=' 
WHERE 
  key_id = '201b9d7c046e8ede4db7511b79720c109a18263ed4e3376b4396456d68eef4cf' 
  AND (
    token = 'dckYC6HgYZbJ8NbScEkevwfp9FpnUVYOnp546ysPLmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035