UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rwND4BQ4ZPN4M1+ajAFFHDkthk3/8IULqxNmhtNV2/g=' 
WHERE 
  key_id = 'b8c5b85df3ae33d6ab0a582365ce8452688d13d1d8e38e41ab85fec14bd21d53' 
  AND (
    token = 'rwND4BQ4ZPN4M1+ajAFFHDkthk3/8IULqxNmhtNV2/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035