UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aqTIz2MjccMA5NPoPankbb4GZkTPjAEO6WIVaZpEPSQ='
WHERE
key_id = '7994acd8f2f21da9b3cd66d5925ffe72c0f6d61d61539830f3cd797b405b14a8'
AND (
token = 'aqTIz2MjccMA5NPoPankbb4GZkTPjAEO6WIVaZpEPSQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)