UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b/nDJRamVrvCRJxCiQEjzivkRWCVgKC3bw/Zrf4Dk6M=' 
WHERE 
  key_id = 'b545d295ff843ff16d72a6a421ee27bfb6676bd84ad0bac6a32e49c894205737' 
  AND (
    token = 'b/nDJRamVrvCRJxCiQEjzivkRWCVgKC3bw/Zrf4Dk6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039