UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y5ESn9C+7Gn8hpyYSyyw3DtE1G7s2MPw1y0FxcWSbo4='
WHERE
key_id = '7b029e7f5ceb4bb6b9118c81df4258993e0e4b697064797d639ff84c65c49736'
AND (
token = 'Y5ESn9C+7Gn8hpyYSyyw3DtE1G7s2MPw1y0FxcWSbo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)