UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r+JuDVhUk04EqCzNZNX8/U9+hlFs0S5K5wr434ddyUg='
WHERE
key_id = '1308a9bf3c826b0bb3d5fec9a7c5aee3435716f717860ee6a17228cb793ccf77'
AND (
token = 'r+JuDVhUk04EqCzNZNX8/U9+hlFs0S5K5wr434ddyUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)