UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GUCfwg9sMcFD7d63zhMZsK0MbDzmvzjduZiDxUJfxzI='
WHERE
key_id = 'bbfa193088b8f68f1add4912f3c7ac79f62c8d3c1bd00462d1b33c23f70cd4e2'
AND (
token = 'GUCfwg9sMcFD7d63zhMZsK0MbDzmvzjduZiDxUJfxzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)