UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o4dMT44Ch2xmq95T7Wskeo0+ZXvyNA5xyiZtazJT6Rk='
WHERE
key_id = '5109f2a13cdf697b87c0c85a1289c662905f9ef4361e03f651be641b2d15e417'
AND (
token = 'o4dMT44Ch2xmq95T7Wskeo0+ZXvyNA5xyiZtazJT6Rk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)