UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dmqwx6cZLHk1T2d3ZudW+wMysn5YKDY6a5VhJcbi+RI=' 
WHERE 
  key_id = '156e6876af15afdc03730892a926d2f8da49f526c5d898d24ccc65b233c35ec5' 
  AND (
    token = 'Dmqwx6cZLHk1T2d3ZudW+wMysn5YKDY6a5VhJcbi+RI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042