UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DMAXNngr9SC6TRvn1MJeri03GJHftS7HjvIzNBCbVCk=' 
WHERE 
  key_id = '7d7a6d8e60ed517a3b582c554f27b6da3443dd361625a8e065cbef93ee470db6' 
  AND (
    token = 'DMAXNngr9SC6TRvn1MJeri03GJHftS7HjvIzNBCbVCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034