UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6rYY7wihMrn1CqGwxQPuyR7mnjlbjXByUNckT2dLlFE='
WHERE
key_id = 'e9b4712b5e80984282f8f835c754e611a65cde996bea630a48b3942fd4240f59'
AND (
token = '6rYY7wihMrn1CqGwxQPuyR7mnjlbjXByUNckT2dLlFE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)