UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tp6W/N6GtkIxZ4GMQoMzM4qgKEnahz/WPArQQqFCxd4='
WHERE
key_id = 'e613e0df81f60242cdfafbf5e4d0e641f95bcc1012adb05dd00f6fce82d5de90'
AND (
token = 'Tp6W/N6GtkIxZ4GMQoMzM4qgKEnahz/WPArQQqFCxd4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)