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