UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uCegWg6SyiOozaG99+lTi+1mIfZwn7aQ+EJ5aktOnxI='
WHERE
key_id = 'f643904546c284d0efc5fe7076d8280265392ee5cfe81b6f9ae14ada53fbf1f5'
AND (
token = 'uCegWg6SyiOozaG99+lTi+1mIfZwn7aQ+EJ5aktOnxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)