UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r1IRyI9+7yAcT3sTbVAdf1TmtGkyZQWpr5hdqIJvzVE='
WHERE
key_id = '3ff06d372071b51e740cee21812b0c24c989a2bd79fef1b5a876f2f0d52d2ce1'
AND (
token = 'r1IRyI9+7yAcT3sTbVAdf1TmtGkyZQWpr5hdqIJvzVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)