UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NZgz0EyY6wmUfpcSlmtBat1FIi2I2SUyCdMmYoBHNAM='
WHERE
key_id = '2ad9d6bd86b159ad3ea09a1c9ec55e09b8882322303d251c68853b14d0f6cd7e'
AND (
token = 'NZgz0EyY6wmUfpcSlmtBat1FIi2I2SUyCdMmYoBHNAM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)