UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E/298yN0pfd4qxXn3JcUT6/yWHk/woD4r1Ujf4UUghI='
WHERE
key_id = '586e0441384805dcc2b431bbc8336b31e7586c7234e155ff234415d1fb66aa2f'
AND (
token = 'E/298yN0pfd4qxXn3JcUT6/yWHk/woD4r1Ujf4UUghI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)