UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bijT0jZRfKIa0TQIr8D6tjftbmFqI52y+gpkZD+jEUI='
WHERE
key_id = 'eba8e8dfb7239109a3e06077e3f40fc35ce0f7d4f36b3eee4e2ac6920277ffbf'
AND (
token = 'bijT0jZRfKIa0TQIr8D6tjftbmFqI52y+gpkZD+jEUI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)