UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wjY8R3hRea17Kmt+sBROWxIhpdw6DxPpOWY9MtefmSI='
WHERE
key_id = 'ec18247c31e5baf1c0b0ab35ca41c2f2b99b0759a6aac15f59093e04ec7006d9'
AND (
token = 'wjY8R3hRea17Kmt+sBROWxIhpdw6DxPpOWY9MtefmSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)