UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ie49FX5WwyoqqnUTjVcEz5XPipOYrsoo89JA8MzaDcQ='
WHERE
key_id = '254c1e8cc5c72cd8e51f0948280c2fdd27b5749283afe64aa24bf266d51aef81'
AND (
token = 'ie49FX5WwyoqqnUTjVcEz5XPipOYrsoo89JA8MzaDcQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)