UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xVeItMYv78y1PDHZiKDSWV/dG5+LLdeI79lXUDkLnIA=' 
WHERE 
  key_id = '1e99da9ca4c032e84f5280b24895cff43d238cd9804f1fee19e66b0c9dcabe00' 
  AND (
    token = 'xVeItMYv78y1PDHZiKDSWV/dG5+LLdeI79lXUDkLnIA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059