UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CcCfDuYhfgxVjHyyjwTrXtRzP2Pu/6xzlk6+xbyD060=' 
WHERE 
  key_id = 'c25681289751bdb9afbc798dd98b17ec2205874ebc90f4a4a00b6815757d885e' 
  AND (
    token = 'CcCfDuYhfgxVjHyyjwTrXtRzP2Pu/6xzlk6+xbyD060=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037