UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jfngEzwWTgV8kY0tA/Pavp3c7w/9Vx/SmI9ajueXa3g='
WHERE
key_id = '8b82e668dc429e5463c78cb70b47bbeb0dd0a1533aa223b28d4e7b6948759cb4'
AND (
token = 'jfngEzwWTgV8kY0tA/Pavp3c7w/9Vx/SmI9ajueXa3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)