UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5d8Eb0bQZoDi1x+flR48Za5K85axtfsw/+RhPNSNTqw=' 
WHERE 
  key_id = 'a60f87d7602c508942ae72998739e3a84a3389248cb3b048ad96ee1a6f86ab35' 
  AND (
    token = '5d8Eb0bQZoDi1x+flR48Za5K85axtfsw/+RhPNSNTqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038