UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd7rgfWo/kTENYaf5Ry2CZz9QhQughyVTQZTIihEFy4A='
WHERE
key_id = '0be1f49dccb3f3c3ab8b616a761ef986015d001fa887d3e9dfc9d3b3be18da63'
AND (
token = 'd7rgfWo/kTENYaf5Ry2CZz9QhQughyVTQZTIihEFy4A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)