UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IVan/3NAWxA6fz2kJt1v3wohlRTwcWk3a6uiBe/lDq0='
WHERE
key_id = '64ab711c45e54ef743bd57241a7c6fe64a3eeaa725d5568d8d741a31de58f04a'
AND (
token = 'IVan/3NAWxA6fz2kJt1v3wohlRTwcWk3a6uiBe/lDq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)