UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O8kPCqS0+GznWK/duFywfE/xtjvUvx7LL/pJwnlsU7E='
WHERE
key_id = '1be5280192da8aa7d08a9613a5c7d95ccb010b162092a11b24ae6eec091ea00a'
AND (
token = 'O8kPCqS0+GznWK/duFywfE/xtjvUvx7LL/pJwnlsU7E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)