UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ua0PmhaEXUVRZWh3oW547DIsb5+w19DNLNtWAtlq8Xw='
WHERE
key_id = '96a4665e2cc739d6dff9360bf5efb5e955d2691514e0608c4a01080857176b7b'
AND (
token = 'Ua0PmhaEXUVRZWh3oW547DIsb5+w19DNLNtWAtlq8Xw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)